package com.example.lin.lifecycle;

import android.app.Activity;
import android.content.DialogInterface;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class LogActivity extends Activity {

    private Button myButton;
    static final String LIFT_TAG = "LogActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Log.v(LogActivity.LIFT_TAG, "FirstActivity --> onCreate");
        Button myButton = (Button) findViewById(R.id.myButton);
        myButton.setText("Activity");
        myButton.setOnClickListener(new ButtonOnClickListener());
    }

    class ButtonOnClickListener implements OnClickListener {
        public void onClick(View v) {
            Intent intent = new Intent();
            intent.setClass(LogActivity.this, LogActivity2.class);
            LogActivity.this.startActivity(intent);
        }
    }

    protected void onDestroy(){
        Log.v(LogActivity.LIFT_TAG, "FirstActivity --> onDestroy");
        super.onDestroy();
    }

    protected void onPause(){
        Log.v(LogActivity.LIFT_TAG, "FirstActivity --> onPause");
        super.onPause();
    }

    protected void onRestart(){
        Log.v(LogActivity.LIFT_TAG, "FirstActivity --> onRestart");
        super.onRestart();
    }

    protected void onResume(){
        Log.v(LogActivity.LIFT_TAG, "FirstActivity --> onResume");
        super.onResume();
    }

    protected void onStart(){
        Log.v(LogActivity.LIFT_TAG, "FirstActivity --> onStart");
        super.onStart();
    }

    protected void onStop(){
        Log.v(LogActivity.LIFT_TAG, "FirstActivity --> onStop");
        super.onStop();
    }
}
